const Koa = require("koa");
var   rootRouter = require("koa-router")();
var   depRouter  = require("./router/DepAction");
const cors = require('koa2-cors');

const app = new Koa();

app.use(cors({
    origin: function (ctx) {
            return "*"; // 允许来自所有域名请求
    }
}));

//子路由注册到根路由
rootRouter.use("/dep",depRouter.routes(),depRouter.allowedMethods());
//根路由注册到app
app.use(rootRouter.routes());
app.listen(3000,()=>{
    console.log("server listener port 30000");
});



